package com.shop.service;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import com.shop.dao.RankDao;
import com.shop.domain.OrderItem;

public class RankService {

	public List<OrderItem> showRank() {
		List<OrderItem> orderItems = new RankDao().showRank();
		Collections.sort(orderItems, new OrderComparator());
		return orderItems;
	}
	
	private class OrderComparator implements Comparator<OrderItem>{

		@Override
		public int compare(OrderItem o1, OrderItem o2) {
			return o2.getBuynum() - o1.getBuynum();
		}
		
	}

}
